/*
 * ****************************************************************************
 * Copyright: 2020-2030, YZChain Tech. Co., Ltd.
 * File name:
 * Description:
 * Author: Dc luo
 * Version: v1.0
 * Date: $DATE
 * History:
 * ***************************************************************************
 */

package com.srp.blockchain.bcos.dto;


import com.srp.common.utils.Date2String;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.math.BigInteger;
import java.util.List;

@ApiModel(value = "合约信息DTO")
public class BlockInfoDTO {

    @ApiModelProperty(value = "区块所在高度")
    private String number;
    @ApiModelProperty(value = "区块哈希")
    private String hash;
    @ApiModelProperty(value = "前区快哈希")
    private String parentHash;
    @ApiModelProperty(value = "出块节点地址")
    private String sealer;
    @ApiModelProperty(value = "Gas消耗数量")
    private String gasUsed;
    @ApiModelProperty(value = "时间戳")
    private String timestamp;
    @ApiModelProperty(value = "交易集合")
    private List<String> transactions;

    public String getNumber() {
        return number;
    }

    public void setNumber(BigInteger number) {
        this.number = number.toString();
    }

    public String getHash() {
        return hash;
    }

    public void setHash(String hash) {
        this.hash = hash;
    }

    public String getParentHash() {
        return parentHash;
    }

    public void setParentHash(String parentHash) {
        this.parentHash = parentHash;
    }

    public String getSealer() {
        return sealer;
    }

    public void setSealer(String sealer) {
        this.sealer = sealer;
    }

    public String getGasUsed() {
        return gasUsed;
    }

    public void setGasUsed(BigInteger gasUsed) {
        this.gasUsed = gasUsed.toString();
    }

    public String getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(BigInteger timestamp) {
        this.timestamp = Date2String.timeStamp2Str(timestamp.longValue());
    }

    public List<String> getTransactions() {
        return transactions;
    }

    public void setTransactions(List<String> transactions) {
        this.transactions = transactions;
    }

    @Override
    public String toString() {
        return "BlockInfoDTO{" +
                "number='" + number + '\'' +
                ", hash='" + hash + '\'' +
                ", parentHash='" + parentHash + '\'' +
                ", sealer='" + sealer + '\'' +
                ", gasUsed='" + gasUsed + '\'' +
                ", timestamp='" + timestamp + '\'' +
                ", transactions=" + transactions +
                '}';
    }
}
